package cn.edu.nwsuaf.examcenter.service.serviceImpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import cn.edu.nwsuaf.examcenter.model.PageModel;
import cn.edu.nwsuaf.examcenter.pojo.ExamItem;
import cn.edu.nwsuaf.examcenter.service.ExamItemService;

@Service(value="examItemService")
public class ExamItemServiceImpl extends BaseServiceImpl<ExamItem> implements ExamItemService{

	@Override
	public void loadExamItem(ModelMap modelMap) {
		
		PageModel<ExamItem> pageModel = new PageModel<>();
		// TODO Auto-generated method stub
		List<ExamItem> list = super.findAll(ExamItem.class);
		
		pageModel.setTotalrows(list.size());
		pageModel.setList(list);
		modelMap.addAttribute("pageModel",pageModel);
	}

	@Override
	public void getExamItemInfo(String examItemNo, ModelMap modelMap) {
		// TODO Auto-generated method stub
		modelMap.addAttribute("examItem",super.getById(ExamItem.class, examItemNo));
	}

}
